A category consists of a name, the list of groups belonging to the category, and a number of optional parameters that override the customizable variables. The complete list of agent parameters are listed below.
agent-groupsagent-predicateagent-scoreagent-enable-expirationagent-days-until-oldagent-low-scoregnus-agent-low-score.agent-high-scoregnus-agent-high-score.agent-short-articlegnus-agent-short-article.agent-long-articlegnus-agent-long-article.agent-enable-undownloaded-facesgnus-summary-*-undownloaded-face faces. Any symbol
other than nil will enable the use of undownloaded
faces.The name of a category can not be changed once the category has been created.
Each category maintains a list of groups that are exclusive members of that category. The exclusivity rule is automatically enforced, add a group to a new category and it is automatically removed from its old category.
A predicate in its simplest form can be a single predicate
such as true or false. These two will
download every available article or nothing respectively. In the
case of these two special predicates an additional score rule is
superfluous.
Predicates of high or low download
articles in respect of their scores in relationship to
gnus-agent-high-score and
gnus-agent-low-score as described below.
To gain even finer control of what is to be regarded eligible for download a predicate can consist of a number of predicates with logical operators sprinkled in between.
Perhaps some examples are in order.
Here's a simple predicate. (It's the default predicate, in fact, used for all groups that don't belong to any other category.)
short
Quite simple, eh? This predicate is true if and only if the article is short (for some value of “short”).
Here's a more complex predicate:
(or high
(and
(not low)
(not long)))
This means that an article should be downloaded if it has a high score, or if the score is not low and the article is not long. You get the drift.
The available logical operators are or,
and and not. (If you prefer, you can
use the more “C”-ish operators
‘|’,
& and ! instead.)
The following predicates are pre-defined, but if none of these fit what you want to do, you can write your own.
When evaluating each of these predicates, the named constant
will be bound to the value determined by calling
gnus-agent-find-parameter on the appropriate
parameter. For example, gnus-agent-short-article will be bound to
(gnus-agent-find-parameter group
'agent-short-article). This means that you can specify a
predicate in your category then tune that predicate to individual
groups.
shortgnus-agent-short-article lines; default
100.longgnus-agent-long-article lines; default
200.lowgnus-agent-low-score; default 0.highgnus-agent-high-score; default 0.spamtruefalseIf you want to create your own predicate function, here's what
you have to know: The functions are called with no parameters,
but the gnus-headers and gnus-score
dynamic variables are bound to useful values.
For example, you could decide that you don't want to download
articles that were posted more than a certain number of days ago
(e.g. posted more than gnus-agent-expire-days ago)
you might write a function something along the lines of the
following:
(defun my-article-old-p ()
"Say whether an article is old."
(< (time-to-days (date-to-time (mail-header-date gnus-headers)))
(- (time-to-days (current-time)) gnus-agent-expire-days)))
with the predicate then defined as:
(not my-article-old-p)
or you could append your predicate to the predefined
gnus-category-predicate-alist in your
~/.gnus.el or
wherever.
(require 'gnus-agent)
(setq gnus-category-predicate-alist
(append gnus-category-predicate-alist
'((old . my-article-old-p))))
and simply specify your predicate as:
(not old)
If/when using something like the above, be aware that there are many misconfigured systems/mailers out there and so an article's date is not always a reliable indication of when it was posted. Hell, some people just don't give a damn.
The above predicates apply to all the groups which belong to the category. However, if you wish to have a specific predicate for an individual group within a category, or you're just too lazy to set up a new category, you can enter a group's individual predicate in its group parameters like so:
(agent-predicate . short)
This is the group/topic parameter equivalent of the agent
category default. Note that when specifying a single word
predicate like this, the agent-predicate
specification must be in dotted pair notation.
The equivalent of the longer example from above would be:
(agent-predicate or high (and (not low) (not long)))
The outer parenthesis required in the category specification are not entered here as, not being in dotted pair notation, the value of the predicate is assumed to be a list.
Now, the syntax of the download score is the same as the
syntax of normal score files, except that all elements that
require actually seeing the article itself are verboten. This
means that only the following headers can be scored on:
Subject, From, Date,
Message-ID, References,
Chars, Lines, and
Xref.
As with predicates, the specification of the download
score rule to use in respect of a group can be in either
the category definition if it's to be applicable to all groups in
therein, or a group's parameters if it's to be specific to that
group.
In both of these places the download score rule
can take one of three forms:
This has the same syntax as a normal Gnus score file except only a subset of scoring keywords are available as mentioned above.
example:
(("from"
("Lars Ingebrigtsen" 1000000 nil s))
("lines"
(500 -100 nil <)))
(agent-score ("from"
("Lars Ingebrigtsen" 1000000 nil s))
("lines"
(500 -100 nil <)))
Again, note the omission of the outermost parenthesis here.
These score files must only contain the permitted scoring keywords stated above.
example:
("~/News/agent.SCORE")
or perhaps
("~/News/agent.SCORE" "~/News/agent.group.SCORE")
(agent-score "~/News/agent.SCORE")
Additional score files can be specified as above. Need I say anything about parenthesis?
normal score files
If you don't want to maintain two sets of scoring rules
for a group, and your desired downloading
criteria for a group are the same as your
reading criteria then you can tell the agent to
refer to your normal score files when deciding
what to download.
These directives in either the category definition or a group's parameters will cause the agent to read in all the applicable score files for a group, filtering out those sections that do not relate to one of the permitted subset of scoring keywords.
file
(agent-score . file)